test(node-integration): Assert mongodb span breakdown for diagnostic failures#21063
Merged
Conversation
Member
|
I just saw this. I think the following might fix it once and for all: #21064 |
Member
Author
|
should we still merge this or do you think your change is good enough? 🤔 |
Member
|
by looking at the code, I'm not quite sure if it would really fix it, as I'm pretty certain that #21064 is already quite sufficient. |
Member
Author
yeah this PR would not fix it, just make it easier to see what exactly/actually fails (which today is a bit hard because you just see 9 instead of 8 spans) |
JPeer264
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
expect(spans).toHaveLength(8)+findSpans.length === 3+isMasterSpans.length === 2triple insuites/tracing/mongodb/test.tswith a singletoEqualon the per-db.operationbreakdown.Why
From the failing run:
The previous assertion told us "8 expected, 9 received" — but nothing about which operation drifted. With this change, when the test fails the same way again, the diff is:
— pointing the next investigator straight at the extra
isMaster(or whichever command actually drifted). The flake itself isn't fixed here; the goal is that the next occurrence is self-diagnosing instead of opaque.Detail
The scenario at
mongodb/scenario.mjsissues 8 commands: 2 isMaster (fromconnect()), 1 insert, 3 find (one each from the twofindOnecalls plus thefind().toArray()), 1 update, 1 endSessions (fromclient.close()). The new assertion encodes that exact breakdown.db.operationisn't set onendSessionsspans — they only expose the command name viadb.statement. The classifier falls back to parsing the leading{"<command>"token out ofdb.statementfor that case.The
toContainEqualmatchers for span shape (find/insert/isMaster/update/endSessions) are unchanged.Fixes #20781
🤖 Generated with Claude Code